var pomelo = window.pomelo;
var host = "192.168.9.2";
// var host = "main.ortron.cn";
var port = "13015";
var connected = 0;
function pomeloInit (callback){
	alert(22)
	pomelo.init({
		host: host,
		port: port,
		log: true
	}, function(data) {
		if(callback){
			callback(data);
			console.log(data);
		}
	
	});
}

_requestPomelo = function (router,reqData,callback){
	pomelo.request(router,reqData, function(data) {
		if(callback)
			callback(data);
	});
}

_addNetListener= function (router,reqData,callback){
	pomelo.on(router,reqData,function(data) {  
		if(callback){
			callback(data);
		}
	});
}


pomeloEnd = function(){
	//console.log(pomelo);
	pomelo.disconnect();
}


_setTitle = function (name){
	console.log("_setTitle:"+name);
	document.title = name;

}

function GetQueryString(name)
{
	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	var s = window.location.search;
	
	var r = s.substr(1).match(reg);
	if(r!=null)
		return r[2];     //注意这里不能用js里面的unescape方法
	return "null";
}


